package com.gitee.cui.springcloud.service;

import com.gitee.cui.springcloud.entities.CommonResult;
import com.gitee.cui.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 调用远程服务提供者的feign接口定义
 * 可以从controller层中直接复制
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022-03-06 13:45
 **/
@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface PaymentFeignService {

	@PostMapping(value = "/payment/create")
	CommonResult<Integer> create(@RequestBody Payment payment);

	@GetMapping(value = "/payment/get/{id}")
	CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

	@GetMapping(value = "/payment/feign/timeout")
	String feignTimeout();
}
